home *** CD-ROM | disk | FTP | other *** search
/ Revolution - Das Atari CD Magazin 1997 / Revolution - Das Atari CD Magazin 1.iso / software / anwendng / utility / cbhd502 / src / c / include / portab.h < prev   
C/C++ Source or Header  |  1997-01-21  |  11KB  |  252 lines

  1. /*****************************************************************************/
  2. /*                                                                           */
  3. /* PORTAB.H                                                                  */
  4. /*                                                                           */
  5. /* Use of this file may make your code compatible with all C compilers       */
  6. /* listed.                                                                   */
  7. /*                                                                           */
  8. /*****************************************************************************/
  9.  
  10. /*****************************************************************************/
  11. /* ENVIRONMENT                                                               */
  12. /*****************************************************************************/
  13.  
  14. #ifndef __PORTAB_H__
  15. #define __PORTAB_H__
  16.  
  17. #define GEMDOS     1                          /* Digital Research GEMDOS     */
  18. #define MSDOS      0                          /* Microsoft MSDOS             */
  19. #define OS2        0                          /* Microsoft OS/2              */
  20. #define FLEXOS     0                          /* Digital Research FlexOS     */
  21. #define UNIX       0                          /* Unix Operating System       */
  22.  
  23. #define M68000     1                          /* Motorola Processing Unit    */
  24. #define I8086      0                          /* Intel Processing Unit       */
  25.  
  26. #define DR_C       0                          /* Digital Research C Compiler */
  27. #define LASER_C    0                          /* Laser C Compiler            */
  28. #define LATTICE_C  0                          /* Lattice C Compiler          */
  29. #define MW_C       0                          /* Mark Williams C Compiler    */
  30. #define TURBO_C    1                          /* Turbo C Compiler            */
  31. #define MS_C       0                          /* Microsoft C Compiler        */
  32. #define HIGH_C     0                          /* Metaware High C Compiler    */
  33. #define PCC        0                          /* Portable C-Compiler         */
  34. #define XL_C       0                          /* AIX C-Compiler/6000         */
  35.  
  36. #define GEM1       0x0001                     /* ATARI GEM version           */
  37. #define GEM2       0x0002                     /* MSDOS GEM 2.x versions      */
  38. #define GEM3       0x0004                     /* MSDOS GEM/3 version         */
  39. #define XGEM       0x0100                     /* OS/2,FlexOS X/GEM version   */
  40.  
  41. #ifndef GEM
  42. #if GEMDOS
  43. #define GEM        GEM1                       /* GEMDOS default is GEM1      */
  44. #endif /* GEMDOS */
  45.  
  46. #if MSDOS
  47. #define GEM        GEM3                       /* MSDOS default is GEM3       */
  48. #endif /* MSDOS */
  49.  
  50. #if OS2
  51. #define GEM        XGEM                       /* OS/2 default is X/GEM       */
  52. #endif /* MSDOS */
  53.  
  54. #if FLEXOS | UNIX
  55. #define GEM        XGEM                       /* FlexOS default is X/GEM     */
  56. #endif /* FLEXOS */
  57. #endif /* GEM */
  58.  
  59. /*****************************************************************************/
  60. /* STANDARD TYPE DEFINITIONS                                                 */
  61. /*****************************************************************************/
  62.  
  63. #define BYTE    char                          /* Signed byte                 */
  64. #define CHAR    char                          /* Signed byte                 */
  65. #define UBYTE   unsigned char                 /* Unsigned byte               */
  66. #define UCHAR   unsigned char                 /* Unsigned byte               */
  67.  
  68. #if LATTICE_C | PCC | XL_C
  69. #define WORD    short                         /* Signed word (16 bits)       */
  70. #define SHORT   short                         /* Signed word (16 bits)       */
  71. #define UWORD   unsigned short                /* Unsigned word               */
  72. #define USHORT  unsigned short                /* Signed word (16 bits)       */
  73. #else
  74. #define WORD    int                           /* Signed word (16 bits)       */
  75. #define SHORT   int                           /* Signed word (16 bits)       */
  76. #define UWORD   unsigned int                  /* Unsigned word               */
  77. #define USHORT  unsigned int                  /* Signed word (16 bits)       */
  78. #endif
  79.  
  80. #define LONG    long                          /* Signed long (32 bits)       */
  81. #define ULONG   unsigned long                 /* Unsigned long               */
  82.  
  83. #define BOOLEAN WORD                          /* 2 valued (true/false)       */
  84. #define BOOL    BOOLEAN                       /* 2 valued (true/false)       */
  85. #define bool    BOOLEAN
  86.  
  87. #define FLOAT   float                         /* Single precision float      */
  88. #define DOUBLE  double                        /* Double precision float      */
  89.  
  90. #define INT     int                           /* A machine dependent int     */
  91. #define UINT    unsigned int                  /* A machine dependent uint    */
  92.  
  93. #define REG     register                      /* Register variable           */
  94. #define AUTO    auto                          /* Local to function           */
  95. #define EXTERN  extern                        /* External variable           */
  96. #define LOCAL   static                        /* Local to module             */
  97. #define MLOCAL  LOCAL                         /* Local to module             */
  98. #ifdef GLOBAL
  99. #undef GLOBAL
  100. #endif
  101. #define GLOBAL                                /* Global variable             */
  102.  
  103. /*****************************************************************************/
  104. /* COMPILER DEPENDENT DEFINITIONS                                            */
  105. /*****************************************************************************/
  106.  
  107. #if GEMDOS                                    /* GEMDOS compilers            */
  108. #if DR_C
  109. #define void WORD                             /* DR_C doesn't know void      */
  110. #endif /* DR_C */
  111.  
  112. #if LASER_C | LATTICE_C | TURBO_C
  113. #define vqt_font_info vqt_fontinfo            /* Wrong GEM binding           */
  114. #define graf_mbox graf_movebox                /* Wrong GEM binding           */
  115. #define graf_rubbox graf_rubberbox            /* Wrong GEM binding           */
  116. #endif /* LASER_C */
  117.  
  118. #if MW_C
  119. #define VOID WORD                             /* MW_C doesn't know (void *)  */
  120. #endif /* MW_C */
  121.  
  122. #if LATTICE_C
  123. #define ADR(A) (LONG)A >> 16, (LONG)A & 0xFFFF
  124. #else
  125. #define ADR(A) (WORD)((LONG)A >> 16), (WORD)((LONG)A & 0xFFFF)
  126. #endif /* LATTICE_C */
  127. #endif /* GEMDOS */
  128.  
  129. #if MSDOS | OS2                               /* MSDOS or OS2 compilers      */
  130. #define ADR(A) (WORD)((LONG)A & 0xFFFF), (WORD)((LONG)A >> 16)
  131. #endif /* MSDOS */
  132.  
  133. #if FLEXOS                                    /* FlexOS compilers            */
  134. #define ADR(A) (WORD)((LONG)A & 0xFFFF), (WORD)((LONG)A >> 16)
  135. #endif /* FLEXOS */
  136.  
  137. #if MS_C | TURBO_C | HIGH_C                   /* ANSI compilers              */
  138. #define ANSI 1
  139. #define _(params) params                      /* Parameter checking          */
  140. #else
  141. #define ANSI 0
  142. #define _(params) ()                          /* No parameter checking       */
  143. #define const
  144. #define volatile
  145. #if DR_C | LASER_C | LATTICE_C | MW_C
  146. #define size_t UINT
  147. #endif
  148. #endif
  149.  
  150. #if DR_C | LASER_C | LATTICE_C | MW_C | HIGH_C | PCC | XL_C
  151. #define cdecl
  152. #define pascal
  153. #endif
  154.  
  155. #define CONST    const
  156. #define VOLATILE volatile
  157. #define CDECL    cdecl
  158. #define PASCAL   pascal
  159.  
  160. #define SIZE_T   size_t
  161.  
  162. #ifndef VOID
  163. #define VOID     void
  164. #endif
  165.  
  166. /*****************************************************************************/
  167. /* OPERATING SYSTEM DEPENDENT DEFINITIONS                                    */
  168. /*****************************************************************************/
  169.  
  170. #if GEMDOS | UNIX
  171. #define NEAR                                  /* Near pointer                */
  172. #define FAR                                   /* Far pointer                 */
  173. #define HUGE                                  /* Huge pointer                */
  174. #else
  175. #if HIGH_C
  176. #define NEAR   _near                          /* Near pointer                */
  177. #define FAR    _far                           /* Far pointer                 */
  178. #define HUGE   _huge                          /* Huge pointer                */
  179. #else
  180. #define NEAR    near                          /* Near pointer                */
  181. #define FAR     far                           /* Far pointer                 */
  182. #define HUGE    huge                          /* Huge pointer                */
  183. #endif /* HIGH_C */
  184. #endif /* GEMDOS */
  185.  
  186. #if MSDOS | OS2 | FLEXOS                      /* MSDOS or OS2 compilers      */
  187. #define FPOFF(a)  (UWORD)(a)
  188. #define FPSEG(a)  ((UWORD)((ULONG)(a) >> 16))
  189. #define MKFP(a,b) ((VOID FAR *)(((ULONG)(a) << 16) | (UWORD)(b)))
  190. #endif /* MSDOS | OS2 | FLEXOS */
  191.  
  192. #if FLEXOS                                    /* FlexOS compilers            */
  193. #define main GEMAIN                           /* Because of X/GEM SRTL       */
  194. #endif /* FLEXOS */
  195.  
  196. #if GEM & GEM1
  197. #define appl_bvset(bvdisk, bvhard)
  198. #define appl_yield() evnt_timer (0, 0)
  199. #define menu_unregister(mid)
  200. #define scrp_clear()
  201. #define xgrf_stepcalc(orgw, orgh, xc, yc, w, h, pcx, pcy, pcnt, pxstep, pystep)
  202. #define xgrf_2box(xc, yc, w, h, corners, cnt, xstep, ystep, doubled)
  203. #endif /* GEM1 */
  204.  
  205. #if GEM & (GEM1 | XGEM)
  206. #define shel_rdef(lpcmd, lpdir)
  207. #define shel_wdef(lpcmd, lpdir)
  208. #endif /* GEM1 | XGEM */
  209.  
  210. #if GEM & (GEM1 | GEM2)
  211. #define menu_click(click, setit)
  212. #define v_copies(handle, count)
  213. #define v_etext(handle, x, y, string, offsets)
  214. #define v_orient(handle, orientation)
  215. #define v_tray(handle, tray)
  216. #define v_xbit_image(handle, filename, aspect, x_scale, y_scale, h_align, v_align, rotate, background, foreground, xy)\
  217.         v_bit_image (handle, filename, aspect, x_scale, y_scale, h_align, v_align, xy)
  218. #define vst_ex_load_fonts(handle, select, font_max, font_free)\
  219.         vst_load_fonts   (handle, select)
  220. #endif /* GEM1 | GEM2 */
  221.  
  222. #if GEM & (GEM2 | GEM3 | XGEM)
  223. #define fsel_exinput(pipath, pisel, pbutton, plabel)\
  224.         fsel_input  (pipath, pisel, pbutton)
  225. #define wind_new()
  226. #endif /* GEM2 | GEM3 | XGEM */
  227.  
  228. /*****************************************************************************/
  229. /* MISCELLANEOUS DEFINITIONS                                                 */
  230. /*****************************************************************************/
  231.  
  232. #ifndef FALSE
  233. #define FALSE   ((BOOLEAN)0)                  /* Function FALSE value        */
  234. #define TRUE    ((BOOLEAN)1)                  /* Function TRUE  value        */
  235. #endif
  236.  
  237. #define FAILURE (-1)                          /* Function failure return val */
  238. #define SUCCESS 0                             /* Function success return val */
  239. #define FOREVER for (;;)                      /* Infinite loop declaration   */
  240. #define EOS     '\0'                          /* End of string value         */
  241.  
  242. #ifndef NULL
  243. #define NULL    0L                            /* Null long value             */
  244. #endif
  245.  
  246. #ifndef EOF
  247. #define EOF     (-1)                          /* EOF value                   */
  248. #endif
  249.  
  250. #endif /* __PORTAB__ */
  251.  
  252.